package com.weizhizs.assistant.code.config;

import lombok.Data;
import org.apache.commons.lang3.StringUtils;

/**
 * @author wutianbin
 * @version 1.0
 * @Time: 2017年5月18日 下午7:29:10
 */
@Data
public class ParamConfig extends PropertiesConfig {

    private static ParamConfig _INSTANCE;

    public static ParamConfig getInstance() {
        if (null == _INSTANCE) {
            _INSTANCE = new ParamConfig();
        }
        return _INSTANCE;
    }

    private String templatePath;

    private String appUrlRoot;
    private String appControllerOutPath;
    private String appControllerBaseClass;

    private String appServiceOutPath;
    private String appVOOutPath;

    private String preTableName;
    private String preFilterName;
    private String urlRoot;
    private String apiOutPath;
    private String dtoOutPath;
    private String queryOutPath;
    private String moduleName;
    private String toOutPath;
    private String queryBaseClass;
    private String doOutPath;
    private String validatePath;
    private String testApiOutPath;
    private String testServiceOutPath;
    private String testControllerOutPath;
    private String enumOutPath;
    private String enumTable;
    private String PropOutPath;
    private String entityBaseClass;
    private String toBaseClass;
    private String verifyFailExceptionClass;
    private String utilsStringExtUtilsClass;
    private String[] entityLocalFields;
    private String ftlOutPath;

    private String daoOutPath;
    private String[] filterUpdateFields;
    private String controllerOutPath;
    private String serviceBaseClass;
    private String serviceOutPath;
    private String controllerBaseClass;
    private String mapperOutPath;
    private String daoBaseClass;
    private String[] filterInsertFields;
    private String serviceImplBaseClass;

    private String authorName;
    private String version;

    private String defaultOrderMode;

    public ParamConfig() {
        super();

        setTemplatePath(config.getString("templatePath"));

        setPreTableName(config.getString("preTableName"));
        setPreFilterName(config.getString("preFilterName"));
        setUrlRoot(config.getString("urlRoot"));
        setApiOutPath(config.getString("apiOutPath"));
        setDtoOutPath(config.getString("dtoOutPath"));
        setQueryOutPath(config.getString("queryOutPath"));
        setModuleName(config.getString("moduleName"));
        setToOutPath(config.getString("toOutPath"));
        setQueryBaseClass(config.getString("queryBaseClass"));
        setDoOutPath(config.getString("doOutPath"));
        setValidatePath(config.getString("validatePath"));

        setTestApiOutPath(config.getString("testApiOutPath"));
        setTestServiceOutPath(config.getString("testServiceOutPath"));
        setTestControllerOutPath(config.getString("testControllerOutPath"));

        setEnumOutPath(config.getString("enumOutPath"));
        setEnumTable(config.getString("enumTable"));

        setPropOutPath(config.getString("propOutPath"));

        setEntityBaseClass(config.getString("entityBaseClass"));
        setToBaseClass(config.getString("toBaseClass"));
        setVerifyFailExceptionClass(config.getString("verifyFailExceptionClass"));
        setUtilsStringExtUtilsClass(config.getString("utilsStringExtUtilsClass"));
        setFtlOutPath(config.getString("ftlOutPath"));

        setDaoOutPath(config.getString("daoOutPath"));
        setControllerOutPath(config.getString("controllerOutPath"));
        setServiceBaseClass(config.getString("serviceBaseClass"));
        setServiceOutPath(config.getString("serviceOutPath"));
        setControllerBaseClass(config.getString("controllerBaseClass"));
        setMapperOutPath(config.getString("mapperOutPath"));
        setDaoBaseClass(config.getString("daoBaseClass"));
        setServiceImplBaseClass(config.getString("serviceImplBaseClass"));

        setAppUrlRoot(config.getString("appUrlRoot"));
        setAppControllerOutPath(config.getString("appControllerOutPath"));
        setAppControllerBaseClass(config.getString("appControllerBaseClass"));

        setAppServiceOutPath(config.getString("appServiceOutPath"));
        setAppVOOutPath(config.getString("appVOOutPath"));

        setFilterInsertFields(readStringArray("filterInsertFields"));
        setFilterUpdateFields(readStringArray("filterUpdateFields"));
        setEntityLocalFields(readStringArray("entityLocalFields"));

        setAuthorName(config.getString("authorName"));
        setVersion(config.getString("version"));

        setDefaultOrderMode(config.getString("defaultOrderMode"));
    }

    public void setTemplatePath(String templatePath) {
        this.templatePath = templatePath;
    }

    public String getAppUrlRoot() {
        return appUrlRoot;
    }

    public void setAppUrlRoot(String appUrlRoot) {
        this.appUrlRoot = appUrlRoot;
    }

    public String getAppControllerOutPath() {
        return appControllerOutPath;
    }

    public void setAppControllerOutPath(String appControllerOutPath) {
        this.appControllerOutPath = appControllerOutPath;
    }

    public String getAppControllerBaseClass() {
        return appControllerBaseClass;
    }

    public void setAppControllerBaseClass(String appControllerBaseClass) {
        this.appControllerBaseClass = appControllerBaseClass;
    }

    public String getAppServiceOutPath() {
        return appServiceOutPath;
    }

    public void setAppServiceOutPath(String appServiceOutPath) {
        this.appServiceOutPath = appServiceOutPath;
    }

    public String getAppVOOutPath() {
        return appVOOutPath;
    }

    public void setAppVOOutPath(String appVOOutPath) {
        this.appVOOutPath = appVOOutPath;
    }

    public String getPreTableName() {
        return preTableName;
    }

    public void setPreTableName(String preTableName) {
        this.preTableName = preTableName;
    }

    public String getPreFilterName() {
        return preFilterName;
    }

    public void setPreFilterName(String preFilterName) {
        this.preFilterName = preFilterName;
    }

    public String getUrlRoot() {
        return urlRoot;
    }

    public void setUrlRoot(String urlRoot) {
        this.urlRoot = urlRoot;
    }

    public String getApiOutPath() {
        return apiOutPath;
    }

    public void setApiOutPath(String apiOutPath) {
        this.apiOutPath = apiOutPath;
    }

    public String getDtoOutPath() {
        return dtoOutPath;
    }

    public void setDtoOutPath(String dtoOutPath) {
        this.dtoOutPath = dtoOutPath;
    }

    public String getQueryOutPath() {
        return queryOutPath;
    }

    public void setQueryOutPath(String queryOutPath) {
        this.queryOutPath = queryOutPath;
    }

    public String getModuleName() {
        return moduleName;
    }

    public void setModuleName(String moduleName) {
        this.moduleName = moduleName;
    }

    public String getToOutPath() {
        return toOutPath;
    }

    public void setToOutPath(String toOutPath) {
        this.toOutPath = toOutPath;
    }

    public String getQueryBaseClass() {
        return queryBaseClass;
    }

    public void setQueryBaseClass(String queryBaseClass) {
        this.queryBaseClass = queryBaseClass;
    }

    public String getDoOutPath() {
        return doOutPath;
    }

    public void setDoOutPath(String doOutPath) {
        this.doOutPath = doOutPath;
    }

    public String getValidatePath() {
        return validatePath;
    }

    public void setValidatePath(String validatePath) {
        this.validatePath = validatePath;
    }

    public String getTestApiOutPath() {
        return testApiOutPath;
    }

    public void setTestApiOutPath(String testApiOutPath) {
        this.testApiOutPath = testApiOutPath;
    }

    public String getTestServiceOutPath() {
        return testServiceOutPath;
    }

    public void setTestServiceOutPath(String testServiceOutPath) {
        this.testServiceOutPath = testServiceOutPath;
    }

    public String getTestControllerOutPath() {
        return testControllerOutPath;
    }

    public void setTestControllerOutPath(String testControllerOutPath) {
        this.testControllerOutPath = testControllerOutPath;
    }

    public String getEnumOutPath() {
        return enumOutPath;
    }

    public void setEnumOutPath(String enumOutPath) {
        this.enumOutPath = enumOutPath;
    }

    public String getPropOutPath() {
        return PropOutPath;
    }

    public void setPropOutPath(String propOutPath) {
        PropOutPath = propOutPath;
    }

    public String getEnumTable() {
        return enumTable;
    }

    public void setEnumTable(String enumTable) {
        this.enumTable = enumTable;
    }

    public String getEntityBaseClass() {
        return entityBaseClass;
    }

    public void setEntityBaseClass(String entityBaseClass) {
        this.entityBaseClass = entityBaseClass;
    }

    public String getToBaseClass() {
        return toBaseClass;
    }

    public void setToBaseClass(String toBaseClass) {
        this.toBaseClass = toBaseClass;
    }

    public String getVerifyFailExceptionClass() {
        return verifyFailExceptionClass;
    }

    public void setVerifyFailExceptionClass(String verifyFailExceptionClass) {
        this.verifyFailExceptionClass = verifyFailExceptionClass;
    }

    public String getUtilsStringExtUtilsClass() {
        return utilsStringExtUtilsClass;
    }

    public void setUtilsStringExtUtilsClass(String utilsStringExtUtilsClass) {
        this.utilsStringExtUtilsClass = utilsStringExtUtilsClass;
    }

    public String[] getEntityLocalFields() {
        return entityLocalFields;
    }

    public void setEntityLocalFields(String[] entityLocalFields) {
        this.entityLocalFields = entityLocalFields;
    }

    public String getFtlOutPath() {
        return ftlOutPath;
    }

    public void setFtlOutPath(String ftlOutPath) {
        this.ftlOutPath = ftlOutPath;
    }

    public String getDaoOutPath() {
        return daoOutPath;
    }

    public void setDaoOutPath(String daoOutPath) {
        this.daoOutPath = daoOutPath;
    }

    public String[] getFilterUpdateFields() {
        return filterUpdateFields;
    }

    public void setFilterUpdateFields(String[] filterUpdateFields) {
        this.filterUpdateFields = filterUpdateFields;
    }

    public String getControllerOutPath() {
        return controllerOutPath;
    }

    public void setControllerOutPath(String controllerOutPath) {
        this.controllerOutPath = controllerOutPath;
    }

    public String getServiceBaseClass() {
        return serviceBaseClass;
    }

    public void setServiceBaseClass(String serviceBaseClass) {
        this.serviceBaseClass = serviceBaseClass;
    }

    public String getServiceOutPath() {
        return serviceOutPath;
    }

    public void setServiceOutPath(String serviceOutPath) {
        this.serviceOutPath = serviceOutPath;
    }

    public String getControllerBaseClass() {
        return controllerBaseClass;
    }

    public void setControllerBaseClass(String controllerBaseClass) {
        this.controllerBaseClass = controllerBaseClass;
    }

    public String getMapperOutPath() {
        return mapperOutPath;
    }

    public void setMapperOutPath(String mapperOutPath) {
        this.mapperOutPath = mapperOutPath;
    }

    public String getDaoBaseClass() {
        return daoBaseClass;
    }

    public void setDaoBaseClass(String daoBaseClass) {
        this.daoBaseClass = daoBaseClass;
    }

    public String[] getFilterInsertFields() {
        return filterInsertFields;
    }

    public void setFilterInsertFields(String[] filterInsertFields) {
        this.filterInsertFields = filterInsertFields;
    }

    public String getServiceImplBaseClass() {
        return serviceImplBaseClass;
    }

    public void setServiceImplBaseClass(String serviceImplBaseClass) {
        this.serviceImplBaseClass = serviceImplBaseClass;
    }

    public String getAuthorName() {
        return authorName;
    }

    public void setAuthorName(String authorName) {
        this.authorName = authorName;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public String getTemplatePath() {
        if (StringUtils.isAnyBlank(templatePath)) {
            return "template";
        } else {
            return templatePath;
        }
    }

    public String getDefaultOrderMode() {
        return defaultOrderMode;
    }

    public void setDefaultOrderMode(String defaultOrderMode) {
        this.defaultOrderMode = defaultOrderMode;
    }
}
